from PIL import Image
import numpy as np
import pandas as pd


# 准换图像28*28 为平坦的一维数组，并进行了高通滤波
img = Image.open('C:\\Users\\kai\\Desktop\\邮科院学习\\神经网络数据\\diy_0.png')
img2 = img.convert('F')
img_data_old = np.array(img2)
img_data = 255.0-img_data_old.flatten()

#

#
for i in range(0,28*28):
    if img_data[i] <50:
        img_data[i] = 0
    elif img_data[i] > 50:
        img_data[i] += 50


test = pd.DataFrame(img_data).T
test.to_csv('C:\\Users\\kai\\Desktop\\邮科院学习\\神经网络数据\\my_diy0.csv')
xx = img_data.reshape(28,28)
